<template>
  <div>
    <div>
      <h4>测试</h4>
      <el-row>
        <el-col>
            <el-select v-model="pgForm.test_value" placeholder="">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
            <span> 级</span>
            <el-input v-model="pgForm.test_input" placeholder="" readonly></el-input>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
export default {
  name: "test",
  title: "测试",
  created() {
    if(this.istrans){
      this.pgForm=this.fromdata
    }
  },
  props: {
    fromdata:{},
    istrans:false,
  },
  data() {
    return {
      options: [{
        value: '0',
        label: '0'
      }, {
        value: '1',
        label: '1'
      }, {
        value: '2',
        label: '2'
      }, {
        value: '3',
        label: '3'
      }, {
        value: '4',
        label: '4'
      }],
      pgForm: {
        test_value: '',
        test_list: ['0分 不能独立站立30秒','1分 尝试几次才能独立站立30秒','2分 能独立站立30秒','3分 在监护下能站立2分钟','4分 能安全的独立站立2分钟'],
        test_input: ''
      }
    }
  },
  watch:{
    'pgForm.test_value': {
      deep: true,
      handler(val){
        this.pgForm.test_input = this.pgForm.test_list[val]
      }
    }
  }
}
</script>

<style scoped>

.el-select{
  width: 10%;
}
.el-input{
  width: 70%;
  margin-left: 30px;
}
.el-row{
  margin: 10px 0;
  padding: 20px 20px;
  background-color: #f9f9f9;
}
.el-col {
  margin:10px 0;
}
</style>
